Formatting Plug-in for LCD Smartie
v1.0 Copyright (c) Jon Grieve 2005
The Formatting Plug-in for LCD Smartie allows the output from other plug-ins for be formatted to better suit the small size
of LCDs, and to display numbers with correct notation.
This plug-in requires the latest .NET Framework Version 2 runtime. At the time of writing, this is currently not
widely installed, and the current (Beta 2) build can be found here.
Usage:
-
$dll(formatting,1,{number},{style}) applies numeric formatting to the {number}
parameter, using the formatting passed in the {style} parameter. The formatting style uses the standard
VB notation. For numeric values, this would generally mean you want to add commas and periods to your
raw numbers. Note: Because LCD Smartie considers the comma (,) a special character, it cannot be
used. In place of a comma, use the left-quote (`) character.
The basic numerical formatting characters are: "0" means that digit will always be shows; "#" only shows
the digit if it is non-zero; "`" (our alternative to comma ",") specifies that a comma should be inserted - if
applicable - in that position; "." specifies a dot or decimal place.
For example,
| $dll(formatting,1,1.23,#`##0.00) |
1.23 |
| $dll(formatting,1,1234.5,#`##0.00) |
1,234.50 |
| $dll(formatting,1,1234567.89,#`###`##0.00) |
1,234,567.89 |
| $dll(formatting,1,10.06,000.0) |
010.1 |
Note, in the last example, because fewer decimal places were required, rounding occured -- consider this a bonus. ;)
Finally, I'm not sure exactly how non-English notations should look, with regard to using the comma and dots the
other way round from... er... me. Sorry for my ignorance.
-
$dll(formatting,2,{text},{length}[#{number of dots}]) shorten a string and adds
ellipsis, if required. In English, that means it will shorten the {text} parameter if it is longer than
{length}. If it is longer than the desired length, it is cut short and ".." is added to neaten the end
of the line. If required, you may specify how many dots are added using the optional {number of dots}
parameter.
For example,
| $dll(formatting,2,123456789012345678901234567890,10) |
12345678.. |
| $dll(formatting,2,123456789012345678901234567890,30#3) |
123456789012345678901234567... |
| $dll(formatting,2,$Rss(http://news.bbc.co.uk/rss/newsonline_uk_edition/world/rss091.xml,d,1),60#3) |
Blah blah blah blah, blah blah blah blah. Blah blah blah... |
-
$dll(formatting,3,{bytes},) converts {bytes} to {bits}. Any numeric values passed
in {bytes} is returned converted to {bits}. As you can imagine, this is a widly-complicated function. If
you even know what that opening sentence means, read on... otherwise, please waste no more of your time and proceed to
function 4 with haste.
(Good, they've gone now)
-
$dll(formatting,4,{number},[{format}]) attempts to format the byte value in {number}
down to a smaller number, and add a "scale". This is designed to take a raw byte value and return a "Kilo", "Mega" or
"Giga" equivalent to save space.
For example,
| $dll(formatting,4,$dll(perf,4,5,\Memory\Available Bytes),#`##0.00)B |
1.72GB |
Installation:
Copy the formatting.dll file to your LCD Smartie\plugin folder (i.e. the plugin folder beneath the folder
wherever you installed LCD Smartie to.
About the author:
Jon Grieve
me@jongrieve.net
http://jongrieve.net